package com.weds.edwx.service;

import com.weds.core.base.BaseService;
import com.weds.core.resp.JsonResult;
import com.weds.edpf.core.constant.WeiXinParams;
import com.weds.edwx.entity.*;
import com.weds.edwx.mapper.AccountMapper;
import com.weds.edwx.mapper.HairCutMapper;
import com.weds.edwx.util.WXPayConstants;
import com.weds.edwx.util.WXPayConstants.SignType;
import com.weds.edwx.util.WXPayUtil;
import com.weds.edwx.util.WxSignUtil;
import com.weds.web.comm.entity.CommProcEntity;
import com.weds.web.comm.service.CommProcService;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.StringHttpMessageConverter;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Author sjm
 * @Description 理发管理
 * @Date 2020-02-24
 */
@Service
public class HairCutService extends BaseService {

    @Autowired
    private HairCutMapper hairCutMapper;

    /**
     * 本月剩余次数
     * @param
     * @return
     * @throws Exception
     */
    public Integer  currentMonthResidualCounts(Integer user_serial){
         ////本月剩余次数==本月充值次数 - 本学消费次数
        Integer currmonc=hairCutMapper.currentMonthCzCounts(user_serial);

        Integer currmonx=hairCutMapper.currentMonthXfCounts(user_serial);

        return (currmonc-currmonx);
    }

    /**
     * 总剩余次数
     * @param
     * @return
     * @throws Exception
     */
    public Integer totalResidualCounts(Integer user_serial){
        return hairCutMapper.totalResidualCounts(user_serial);
    }

    /**
     *预约记录
     */
    public List<AppointmentRecordEntity> selectAppointmentListByEntity(Integer user_serial){
        return hairCutMapper.selectAppointmentListByEntity(user_serial);
    }



    /**
     * 本月消费次数
     * @param
     * @return
     * @throws Exception
     */
    public Integer currentMonthConsumeCount(HairCutCollectReq hairCutCollectReq){
        return hairCutMapper.currentMonthConsumeCount(hairCutCollectReq);
    }


    /**
     * 本月补贴次数
     * @param
     * @return
     * @throws Exception
     */
    public Integer currentMonthSubsidyCount(HairCutCollectReq hairCutCollectReq){
        return hairCutMapper.currentMonthSubsidyCount(hairCutCollectReq);
    }



    /**
     *理发记录
     */
    public List<HairCutConsumeSubsidyEntity> selectHairCutListByEntity(HairCutConsumeSubsidyReq record){
        return hairCutMapper.selectHairCutListByEntity(record);
    }

    /**
     *充值记录
     */
    public List<RechargeRecordEntity> selectRechargeListByEntity(Integer user_serial){
        return hairCutMapper.selectRechargeListByEntity(user_serial);
    }
    /**
     *补贴记录
     */
    public List<HairCutConsumeSubsidyEntity> selectSubsidyListByEntity(HairCutConsumeSubsidyReq record){
        return hairCutMapper.selectSubsidyListByEntity(record);
    }


}
